#include "BondAuctionInfo.h"

#include <core/Utility.h>
#include <string.h>

#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

#ifdef _DEBUG
// #define	new	DEBUG_NEW
#endif

CBondAuctionInfo::CBondAuctionInfo() { Clear(); }

CBondAuctionInfo::CBondAuctionInfo(const CBondAuctionInfo& info) {
  memcpy(m_BondKey, info.m_BondKey, sizeof(m_BondKey));
  m_AuctionTimeStart = info.m_AuctionTimeStart;
  m_AuctionTimeEnd = info.m_AuctionTimeEnd;
  m_PlanedAuctionAmount = info.m_PlanedAuctionAmount;
  m_ActualAuctionAmount = info.m_ActualAuctionAmount;
  m_WATenderRate = info.m_WATenderRate;
  m_MGTenderRate = info.m_MGTenderRate;
  m_SubscriptionRatio = info.m_SubscriptionRatio;
  m_MarginalRatio = info.m_MarginalRatio;
}

CBondAuctionInfo::~CBondAuctionInfo() {}

void CBondAuctionInfo::Clear() {
  memset(m_BondKey, 0, sizeof(m_BondKey));
  m_AuctionTimeStart = 0;     // 招标时间起
  m_AuctionTimeEnd = 0;       // 招标时间止
  m_PlanedAuctionAmount = 0;  // 计划发行量
  m_ActualAuctionAmount = 0;  // 实际发行量
  m_WATenderRate = 0;         // 加权利率
  m_MGTenderRate = 0;         // 边际利率
  m_SubscriptionRatio = 0;    // 全场倍数
  m_MarginalRatio = 0;        // 边际倍数
}

void CBondAuctionInfo::SetBondKey(const char* sBondKey) {
  FIELDCOPY(m_BondKey, sBondKey);
}
void CBondAuctionInfo::SetAuctionTimeStart(int v) { m_AuctionTimeStart = v; }
void CBondAuctionInfo::SetAuctionTimeEnd(int v) { m_AuctionTimeEnd = v; }
void CBondAuctionInfo::SetPlanedAuctionAmount(double v) {
  m_PlanedAuctionAmount = v;
}
void CBondAuctionInfo::SetActualAuctionAmount(double v) {
  m_ActualAuctionAmount = v;
}
void CBondAuctionInfo::SetWATenderRate(double v) { m_WATenderRate = v; }
void CBondAuctionInfo::SetMGTenderRate(double v) { m_MGTenderRate = v; }
void CBondAuctionInfo::SetSubscriptionRatio(double v) {
  m_SubscriptionRatio = v;
}
void CBondAuctionInfo::SetMarginalRatio(double v) { m_MarginalRatio = v; }

const char* CBondAuctionInfo::GetBondKey() const { return m_BondKey; }
int CBondAuctionInfo::GetAuctionTimeStart() const { return m_AuctionTimeStart; }
int CBondAuctionInfo::GetAuctionTimeEnd() const { return m_AuctionTimeEnd; }
double CBondAuctionInfo::GetPlanedAuctionAmount() const {
  return m_PlanedAuctionAmount;
}
double CBondAuctionInfo::GetActualAuctionAmount() const {
  return m_ActualAuctionAmount;
}
double CBondAuctionInfo::GetWATenderRate() const { return m_WATenderRate; }
double CBondAuctionInfo::GetMGTenderRate() const { return m_MGTenderRate; }
double CBondAuctionInfo::GetSubscriptionRatio() const {
  return m_SubscriptionRatio;
}
double CBondAuctionInfo::GetMarginalRatio() const { return m_MarginalRatio; }